<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增评论')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-comment-add">

            <div class="form-group">    
                <label class="col-sm-3 control-label">商品：</label>
                <div class="col-sm-8">
                    <input name="goodsId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">会员：</label>
                <div class="col-sm-8">
                    <input name="memberId" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">评分：</label>
                <div class="col-sm-8">
                    <input name="source" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">
            <label class="col-sm-3 control-label">评论状态(是否显示)：</label>
                <div class="col-sm-3">
                    <label class="toggle-switch switch-solid">
                        <input type="checkbox" id="status" checked>
                        <span></span>
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">评论：</label>
                <div class="col-sm-8">
                    <input name="content" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "normal/comment"
        $("#form-comment-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var status = $("input[id='status']").is(':checked') == true ? 1 : 0;
                var data = $.param({'status': status}) + '&' +
                    $('#form-comment-add').serialize();
                $.operate.save(prefix + "/add", data);
            }
        }
    </script>
</body>
</html>